#pragma strict

//FIXME Better random values spawnpositions (less clusterisation)
public function deadZoneRandomRange(randomRangeNeg : float, randomRangePos : float, deadZoneNeg : float,  deadZonePos : float) : float{
	if(randomRangeNeg == deadZoneNeg || randomRangePos == deadZonePos){
		//FIXME Exception handling !!!
		return 20;
	}

	deadZoneNeg = (deadZoneNeg < 0) ? deadZoneNeg : -deadZoneNeg;
	
	while(true){
		var randomRange : float = Random.Range(randomRangeNeg, randomRangePos);
		
		if(randomRange < deadZoneNeg || randomRange > deadZonePos){
		 	return randomRange;
		}
	}
}

public function MakeTexture(width : int, height : int, color : Color) : Texture2D{
        var pix : Color[] = new Color[width * height];
        
        for(var i : int = 0; i < pix.Length; i++){
            pix[i] = color;
        }
        
        var result : Texture2D = new Texture2D(width, height);
        result.SetPixels(pix);
        result.Apply();
        
        return result;
}